Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve IronPython2 code completion performance #15731

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dimven-adsk
Copy link

@dimven-adsk dimven-adsk commented Dec 18, 2024

Purpose

Getting the __doc__ docstrings in the IronPython2 can be very slow (15-100ms) for each call. Every time you press . on a large namespace or type, Dynamo (and possibly its host) freezes. Whenever you use the Autodesk.Revit.DB. namespace for example, Revit freezes for multiple seconds, making editing iron python 2 scripts a horrible experience.

Luckily the experience is much better in IronPython3 and getting the docstrings is much faster.

Unfortunately, it CPython getting the docstrings has not been implemented yet.

This PR also implements lazy loading of the in the overarching class and delays the execution until the description is actually displayed and needed.


User Experience

This is what a user experiences currently (felt like 10 seconds to me):
Revit_NuFinWQq1R

And here's the now instantaneous experience with the proposed changes:
Revit_a3bCGADYqW

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

(FILL ME IN) Brief description of the fix / enhancement. Use N/A to indicate that the changes in this pull request do not apply to Release Notes. Mandatory section

Reviewers

(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)

(FILL ME IN, optional) Any additional notes to reviewers or testers.

FYIs

@bendikberg, @mjkkirschner

@dimven-adsk dimven-adsk changed the title implement description lazy loading Improve IronPython2 usability Dec 18, 2024
@mjkkirschner
Copy link
Member

mjkkirschner commented Dec 20, 2024

I'm interested to understand what is actually slow here - it's not clear to me what the difference would be between ironpython2 and 3 - it looks like both of them are actually using the DSCPythonCodeCompletionProviderCore?

okay, so ironPython2 uses the ironPython based completion core:
https://github.com/DynamoDS/DSIronPython/blob/master/DSIronPython/IronPythonCodeCompletionProviderCore.cs

but ironPython3 just falls back to the DSCPython based one... I have no idea if it actually works though, it's just a fallback - so comparing their performance is not really appropriate.

I think likely this PR avoids eagerly doing whatever super slow stuff we have in the legacy IronPythonCodeCompletionProvider though so it seems okay to me.

Copy link

UI Smoke Tests

Test: success. 11 passed, 0 failed.
TestComplete Test Result
Workflow Run: UI Smoke Tests
Check: UI Smoke Tests

@mjkkirschner mjkkirschner self-requested a review December 20, 2024 02:43
@mjkkirschner
Copy link
Member

test failure:
DynamoCoreWpfTests.DocumentationBrowserViewExtensionTests.DocsAreLoadedFromHostPathBeforeCorePath (from DynamoCoreWpfTests.dll)

but I have no idea what is real or flaky, even if things seems unrelated - that's not really acceptable to merge if a PR causes a failure.

@mjkkirschner mjkkirschner changed the title Improve IronPython2 usability Improve IronPython2 code completion performance Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants